<?php
define('BEVIN', TRUE);
include_once("include/common.inc.php");

if($_POST['submit']) {
	if($_POST['password'] != $_POST['re_password']) {
		message("输入的两次密码不一致！","register.php");
	}

	if($_POST['username'] && $_POST['password']) {
		$username = str_clear($_POST['username']);
		$email = str_clear($_POST['email']);
		if($user->register($username,$_POST['password'],$email)) {
			message("您已注册成功！",'index.php');
		} else {
			message("用户名已存在！",'register.php');
		}
	} else {
		message("请输入正确填写您的用户名和密码！",'register.php');
	}
}

$smarty->display('register.html');
?>